﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>GetLayerByUrl</title>
    <script src="../../lib/XiaoFuMap.js" type="text/javascript"></script>
    <script type="text/javascript">
        
        var map;
        function load() {
            map = new XiaoFu.Map("#MapContainer");
            var layer = new XiaoFu.BaiDuCacheLayer("http://q{0}.baidu.com/it/u=x={1};y={2};z={3};v=011;type=web&fm=44");
            layer.serverUrl = "http://192.168.0.23/arcgiscache/World/Layers/_alllayers";
            layer.picFormat = "png";
            map.addLayer(layer);
            map.mousemove = function (geo, point) {
                var center = map.getCenter();
                var extent = map.getCurrentExtent();
                var mouseGeo = geo;
                var mousePoint = point;
                var txt = ""
                + "<br/>地图中心 x-" + center.x + " y-" + center.y
                + "<br/>地图当前范围 minX-" + extent.minX + "minY-" + extent.minY + "maxX-" + extent.maxX + "maxY-" + extent.maxY
                + "<br/>鼠标地理点 x-" + mouseGeo.x + " y-" + mouseGeo.y
                + "<br/>鼠标点 x-" + mousePoint.x + " y-" + mousePoint.y;
                showMsg(txt);

            }
        }
        function showMsg(_msg) {
            $("#msg").html(_msg);
        }
        function zoomIn() {
            map.zoomIn();
        }
        function  panTo() {
            var p = new XiaoFu.GeoPoint(116.404, 39.915);
            //var p = new XiaoFu.GeoPoint(0,0);
            map.panTo(p);
        }
       
        function zoomOut() {
            map.zoomOut();
        } 
    </script>
</head>
<body onload="load()">
    <div id="MapContainer" style="z-index: 10000; border: 1px solid blue; position: relative;
        width: 1000px; height: 500px;">
    </div>  
    <input type="button" value="ZoomIn" onclick="zoomIn()" />
    <input type="button" value="ZoomOut" onclick="zoomOut()" />
     <input type="button" value="PanTo" onclick="panTo()" />
    <div id="msg">
    </div>
</body>
</html>
